using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PBR
{
    public partial class NewProjectDialog : Form
    {
        public string colorFilename;
        public string segmentFilename;

        public NewProjectDialog()
        {
            InitializeComponent();
        }

        public bool ThumbnailCallback()
        {
            return false;
        }

        private void browseColorImageBtn_Click(object sender, EventArgs e)
        {
            // get the color image
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Title = "Choose a Color Image";
            openFileDialog.Filter = "PNG(.png)|*.png";
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            colorImageTextBox.Text = openFileDialog.FileName;
            colorFilename = openFileDialog.FileName;

            // load a preview
            Bitmap colorImage = new Bitmap(colorFilename);
            Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
            Image thumbnail = colorImage.GetThumbnailImage(64, 64, myCallback, IntPtr.Zero);
            colorImagePictureBox.Image = thumbnail;
        }

        private void browseSegmentImageBtn_Click(object sender, EventArgs e)
        {
            // get the color image
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Title = "Choose a Segment Image";
            openFileDialog.Filter = "PNG(.png)|*.png";
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            segmentImageTextBox.Text = openFileDialog.FileName;
            segmentFilename = openFileDialog.FileName;

            // load a preview
            Bitmap segmentImage = new Bitmap(segmentFilename);
            Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
            Image thumbnail = segmentImage.GetThumbnailImage(64, 64, myCallback, IntPtr.Zero);
            segmentImagePictureBox.Image = thumbnail;
        }
    }
}